/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.foxline.service;

import br.com.foxline.model.TypeStamp;
import br.com.foxline.util.Msg;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.Query;

/**
 *
 * @author roniere
 */
@Stateless
public class TypeStampService extends GenericService<TypeStamp>{

    public TypeStampService() {
        super(TypeStamp.class);
    }
    
    
    public void saveStamp(TypeStamp stamp){
        
          try{
                save(stamp);
                Msg.messagemInfo("Tipo Selo Cadastrado com Sucesso ");
          }catch(Exception erro){
              
          }
        
    }
    
    
     public List<TypeStamp> autoComplete(String str){
        String sql = "Select ts from TypeStamp ts where lower(ts.name) like lower(:name)";
        Query query = getEntityManager().createQuery(sql);
        query.setParameter("name", str+"%");
        return (List<TypeStamp>) query.getResultList();
    }
    
}
